﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nuclex.UserInterface.Controls.Desktop;
using Nuclex.UserInterface.Controls;
using Microsoft.Xna.Framework.Graphics;
using Nuclex.UserInterface;

namespace FierceWar
{
	public class SaveMapDialog : WindowControl
	{
		private LabelControl _message;

		public InputControl Input;
		
		private ButtonControl _save;
		private ButtonControl _cancel;

		public SaveMapDialog(GraphicsDevice graphicsDevice,
			List<EventHandler> eventHandlers)
		{
			// Message.
			_message = new LabelControl("Type name of the map you want to save");
			_message.Bounds = new UniRectangle(10.0f, 30.0f, 120.0f, 30.0f);

			// Input.
			Input = new InputControl();
			Input.Bounds = new UniRectangle(10.0f, 60.0f, 380.0f, 25.0f);

			// Save button.
			_save = new ButtonControl();
			_save.Text = "Save";
			_save.Bounds = new UniRectangle(
				new UniScalar(1.0f, -180.0f), new UniScalar(1.0f, -40.0f),
				80.0f, 25.0f
			);
			_save.Pressed += eventHandlers[0];

			// Cancel button.
			_cancel = new ButtonControl();
			_cancel.Text = "Cancel";
			_cancel.Bounds = new UniRectangle(
				new UniScalar(1.0f, -90.0f), new UniScalar(1.0f, -40.0f),
				80.0f, 25.0f
			);
			_cancel.Pressed += eventHandlers[1];

			// Dialog.
			float width = 400.0f;
			float height = 150.0f;
			Bounds = new Nuclex.UserInterface.UniRectangle(
				(graphicsDevice.Viewport.Width - width) / 2,
				(graphicsDevice.Viewport.Height - height) / 2,
				width, height);
			Children.Add(_message);
			Children.Add(Input);
			Children.Add(_save);
			Children.Add(_cancel);
		}
	}
}
